<?php

namespace app\common\model;

class Article extends Common
{
    protected function getAlldataAttr($value, $data)
    {
        // $data['tagname'] = model('Tag')->where('id', $data['tagid'])->value('tagname');
        $data['cover'] = $data['cover'] ? APP_URL . $data['cover'] : '';
        $data['datetime'] = date("Y-m-d H:i", $data['datetime']);
        $data['dealer'] = model('AdminUser')->where('userid', $data['dealerid'])->value('realname');
        // $data = $this->modelDb->field('articleid, count(*) as total')->group('articleid')->select();
        $data['total'] = model('redpacket')->where('articleid', $data['id'])->count();
        return $data;
    }
}